package service

import (
	"context"

	"gitee.com/youkelike/zlog"
	"gitee.com/youkelike/zmigrate/example/interactive/repository"
)

//go:generate mockgen -source=interactive.go -package=svcmocks -destination=mocks/interactive.mock.go InteractiveService
type InteractiveService interface {
	IncrReadCnt(ctx context.Context, biz string, bizId int64) error
	// Like 点赞
	Like(ctx context.Context, biz string, bizId int64, uid int64) error
}

type interactiveService struct {
	repo repository.InteractiveRepository
	l    zlog.Logger
}

func (i *interactiveService) IncrReadCnt(ctx context.Context, biz string, bizId int64) error {
	return i.repo.IncrReadCnt(ctx, biz, bizId)
}

func (i *interactiveService) Like(ctx context.Context, biz string, bizId int64, uid int64) error {
	return i.repo.IncrLike(ctx, biz, bizId, uid)
}

func NewInteractiveService(repo repository.InteractiveRepository,
	l zlog.Logger) InteractiveService {
	return &interactiveService{
		repo: repo,
		l:    l,
	}
}
